<?php
function __autoload($class_name)
 {
	if(substr($class_name, -10) == 'Controller')
	{
		include_once 'application/controllers/'.$class_name.'.php';
	}elseif(substr($class_name, -5) == 'Model')
	{
		include_once 'application/models/'.$class_name.'.php';
	}else{
		include_once 'lib/'.lcfirst($class_name). '.php';
	}
}

//分配模版
function view($param1 = '',$param2 = '')
{
	include 'application/views/'.strtolower($param1).'/'.$param2.'.html';
}

//连接数据库
function getDB(){
	//return new PDO("mysql:host=localhost;dbname=shop;port=3306",'root','123456');
	$dbConn = include_once 'conf/config.php';
	return new PDO("mysql:host={$dbConn['HOST']};dbname={$dbConn['DBNAME']};port={$dbConn['PORT']}",$dbConn['USER'],$dbConn['PASSWORD']);
}